package com.yuanheng100.asset.consts.common;


/**
 * 对时间单位的定义
 * @author baisong
 *
 */
public interface TimeDef
{

    /**
     * 一秒钟长度
     */
    long ONE_SECOND = 1000;
    /**
     * 一分钟的长度
     */
    long ONE_MINUTE = 60L * 1000;
    /**
     * 一个小时的长度，修改此值将影响邮件验证过期的判断
     */
    long ONE_HOUR = ONE_MINUTE * 60;
    /**
     * 一天的长度，修改此值将影响逾期天数的计算
     */
    long ONE_DAY = ONE_HOUR * 24;
    
    

    /**
     * 还款周期
     * @author Baisong
     *
     */
    public enum InstallmentUnit
    {
        DAY((short)10),
        
        WEEK((short)20),
        
        MONTH((short)30),
        
        YEAR((short)40);
        
        private final short value;
        
        InstallmentUnit(short value)
        {
            this.value = value;
        }

        public short getValue()
        {
            return value;
        }
        
        public static InstallmentUnit parseShort(short value)
        {
            switch ((int)value)
            {
            case 1:
                return InstallmentUnit.DAY;
            case 2:
                return InstallmentUnit.WEEK;
            case 3:
                return InstallmentUnit.MONTH;
            case 4:
                return InstallmentUnit.YEAR;
            default:
                throw new IllegalArgumentException("错误的InstallmentUnit参数");
            }
                
        }
    }
}
